home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / gopher / Unix / NeXTtext / text / wftable.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-04  |  1.3 KB  |  37 lines

  1. #ifndef _WFTABLE_H_
  2. #define _WFTABLE_H_
  3.  
  4. #import <stdio.h>
  5.  
  6. /*
  7.  * A Word Frequency Table (WFTable) is a hashed image of
  8.  * a word histogram.  The data structure is fairly compact,
  9.  * and includes a hash table so that functions like
  10.  *    frequency(word,table)
  11.  * can be easily implemented.  Tables can be read from
  12.  * and written to files efficiently.
  13.  */
  14. typedef struct {
  15.     long total;    /* total number of words in sample */
  16.     long unique;    /* number of unique words in sample */
  17.     long textSize;    /* number of bytes of 'text' */
  18.     long tableSize;    /* number of *entries* in 'table' */
  19.     char *text;    /* string of "word\0rank count word\0rank count..." */
  20.     long *table;    /* pointers into text vector */
  21. } WFTable;
  22.  
  23. extern WFTable *makeWFTableFromHistogram(char *file, FILE *fp);
  24. extern char *findWFTable(char *file);
  25. extern WFTable *readWFTable(char *file);
  26. extern int writeWFTable(WFTable *t, char *file);
  27. extern intfreeWFTable(WFTable *t);
  28. extern WFTable *DefaultLanguageWFTable(void);
  29. extern unsigned long wordStat(register char *word, WFTable *t, long *rank);
  30. extern unsigned long wordRank(register char *word, WFTable *t);
  31. extern unsigned long wordCount(register char *word, WFTable *t);
  32. extern float wordFrequency(char *word, WFTable *t);
  33. extern double wordPeculiarity(char *s, double count, double total, WFTable *t);
  34.  
  35. #endif
  36.  
  37.